﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CategoryItem.aspx.cs" Inherits="Admin_CategoryItem" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="EN" lang="EN" dir="rtl">
<head id="Head1" profile="http://gmpg.org/xfn/11" runat="server">
    <title>آزمایشات</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <meta http-equiv="imagetoolbar" content="no" />
    <link href="../App_Themes/Default/css/B_Yekan.css" rel="stylesheet" type="text/css" />
    <link href="../App_Themes/Default/css/layout.css" rel="stylesheet" type="text/css" />
</head>
<body id="top">
    <form id="Form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <div class="wrapper row1">
        <div id="header" class="clear">
            <div class="fl_right">
                    <img src="../App_Themes/Default/images/Logo.png" alt="" />
            </div>
        </div>
    </div>
    <!-- ####################################################################################################### -->
    <div class="wrapper row2">
        <div id="topnav">
            <ul>
                <li><a id="A1" href="~/Admin/Confirm.aspx" runat="server">آزمایش های تایید شده</a></li>
                <li><a id="A2" href="~/Admin/Paper.aspx" runat="server">مقاله ها</a></li>
                <li><a id="A3" href="~/Admin/Help.aspx" runat="server">راهنمای پذیرش</a></li>
                <li><a id="A4" href="~/Admin/Gallery.aspx" runat="server">گالری</a></li>
                <li><a id="A5" href="~/Admin/Sentence.aspx" runat="server">جمله روز</a></li>
                <li><a id="A6" href="~/Admin/Category.aspx" runat="server">گروه آزمایش</a></li>
                <li class="current"><a id="A8" href="~/Admin/CategoryItem.aspx" runat="server">آزمایشات</a></li>
                <li><a id="A9" href="~/Admin/User.aspx" runat="server">کاربران</a></li>
                <li><a id="A10" href="~/Admin/ChangePassword.aspx" runat="server">تغییر رمز</a></li>
                <li><a id="logout_a" href="#" runat="server" onclick="if(!confirm('آیا قصد خروج از سیستم را دارید؟')) return false;"
                    onserverclick="LogoutButton_Click">خروج از سیستم</a></li>
            </ul>
            <div class="clear">
            </div>
        </div>
    </div>
    <!-- ####################################################################################################### -->
    <div class="wrapper row4">
        <div id="container" class="clear">
            <!-- ####################################################################################################### -->
            <div id="homepage" class="clear">
                <!-- ############### -->
                <div>
                    <h2 class="title">
                        آزمایشات</h2>
                    <div align="center">
                        <asp:MultiView ID="MultiView" runat="server" ActiveViewIndex="0">
                            <asp:View ID="ShowView" runat="server">
                                <table style="width: 100%;">
                                    <tr style="color: #97AEB3;">
                                        <td>
                                            گروه آزمایش:
                                        </td>
                                        <td style="width: 250px">
                                            <asp:TextBox ID="CategoryTextBox" runat="server" Width="200px"></asp:TextBox>
                                        </td>
                                        <td>
                                            سایز صفحه:
                                        </td>
                                        <td>
                                            <asp:DropDownList ID="PageSizeDropDownList" SkinID="SearchDropDownList" runat="server">
                                                <asp:ListItem Selected="True" Value="5">[پیش فرض]</asp:ListItem>
                                                <asp:ListItem Value="5">5 رکورد</asp:ListItem>
                                                <asp:ListItem Value="10">10 رکورد</asp:ListItem>
                                                <asp:ListItem Value="15">15 رکورد</asp:ListItem>
                                                <asp:ListItem Value="20">20 رکورد</asp:ListItem>
                                                <asp:ListItem Value="25">25 رکورد</asp:ListItem>
                                                <asp:ListItem Value="1000000">تمام رکورد ها</asp:ListItem>
                                            </asp:DropDownList>
                                        </td>
                                        <td>
                                            <asp:ImageButton ID="SearchImageButton" runat="server" OnClick="SearchImageButton_Click"
                                                SkinID="SearchButton" />
                                            <asp:ImageButton ID="ClearImageButton" runat="server" OnClick="ClearImageButton_Click"
                                                OnClientClick="return false;" SkinID="ClearButton" />
                                        </td>
                                    </tr>
                                    <tr align="center">
                                        <td colspan="5">
                                            <table>
                                                <tr>
                                                    <td align="center" valign="middle">
                                                        <asp:GridView ID="CategoryGridView" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                                                            DataKeyNames="CategoryID" DataSourceID="CategoryEntityDataSource" HorizontalAlign="Center"
                                                            OnSelectedIndexChanged="CategoryGridView_SelectedIndexChanged" Width="100%" PageSize="5">
                                                            <Columns>
                                                                <asp:BoundField DataField="CategoryID" HeaderText="CategoryID" ReadOnly="True" Visible="false"
                                                                    SortExpression="CategoryID" />
                                                                <asp:TemplateField>
                                                                    <ItemTemplate>
                                                                        <asp:ImageButton ID="SelectImageButton" runat="server" CommandName="Select" SkinID="SelectButton" />
                                                                    </ItemTemplate>
                                                                    <ItemStyle Width="25px" />
                                                                </asp:TemplateField>
                                                                <asp:BoundField DataField="CategoryTitle" HeaderText="عنوان گروه" ReadOnly="True"
                                                                    SortExpression="CategoryTitle">
                                                                    <ItemStyle Width="300px" />
                                                                </asp:BoundField>
                                                                <asp:BoundField DataField="Description" HeaderText="توضیحات" ReadOnly="True" SortExpression="Description">
                                                                    <ItemStyle Width="450px" />
                                                                </asp:BoundField>
                                                            </Columns>
                                                        </asp:GridView>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                            </asp:View>
                            <asp:View ID="EditView" runat="server">
                                <table>
                                    <tr style="color: #FFFFFF">
                                        <td style="width: 450px">
                                            عنوان گروه آزمایش:
                                            <asp:Label ID="CategoryLabel" runat="server" Text=""></asp:Label>
                                        </td>
                                        <td>
                                        </td>
                                        <td style="text-align: center; width: 450px">
                                            <asp:LinkButton ID="ReturnLinkButton" runat="server" OnClick="ReturnLinkButton_Click"
                                                CssClass="linkbutton">بازگشت</asp:LinkButton>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td valign="top" style="width: 450px">
                                            <asp:GridView ID="CategoryItemGridView" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                                                DataKeyNames="CategoryItemID" DataSourceID="CategoryItemEntityDataSource" HorizontalAlign="Center"
                                                OnSelectedIndexChanged="CategoryItemGridView_SelectedIndexChanged" Width="100%"
                                                AllowSorting="True" PageSize="5">
                                                <Columns>
                                                    <asp:TemplateField>
                                                        <ItemTemplate>
                                                            <asp:ImageButton ID="SelectImageButton" runat="server" CommandName="Select" SkinID="SelectButton" />
                                                        </ItemTemplate>
                                                        <ItemStyle Width="25px" />
                                                    </asp:TemplateField>
                                                    <asp:BoundField DataField="CategoryItemID" HeaderText="CategoryItemID" ReadOnly="True"
                                                        SortExpression="CategoryItemID" Visible="false" />
                                                    <asp:BoundField DataField="CategoryItemTitle" HeaderText="عنوان آزمایش" SortExpression="CategoryItemTitle" />
                                                    <asp:BoundField DataField="Description" HeaderText="توضیحات" SortExpression="Description" />
                                                </Columns>
                                            </asp:GridView>
                                        </td>
                                        <td style="width: 20px">
                                        </td>
                                        <td style="width: 450px" valign="top">
                                            <asp:FormView ID="CategoryItemFormView" runat="server" DataSourceID="CategoryItemEntityDataSource"
                                                DataKeyNames="CategoryItemID" DefaultMode="Insert" OnItemCommand="CategoryItemFormView_ItemCommand"
                                                Width="100%">
                                                <EditItemTemplate>
                                                    <table border="0" cellpadding="0" cellspacing="0">
                                                        <tr valign="middle">
                                                            <td style="width: 100px" align="right">
                                                                عنوان آزمایش :
                                                            </td>
                                                            <td style="width: 400px" align="right">
                                                                <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("CategoryItemTitle") %>'
                                                                    MaxLength="500" Width="350px" />
                                                                <asp:RequiredFieldValidator ID="TitleRequiredFieldValidator" runat="server" ControlToValidate="TitleTextBox"
                                                                    Display="Dynamic" ErrorMessage="*" ValidationGroup="Update"></asp:RequiredFieldValidator>
                                                                <asp:HiddenField ID="CategoryIDHiddenField" runat="server" Value='<%# Bind("CategoryID") %>' />
                                                            </td>
                                                        </tr>
                                                        <tr valign="middle">
                                                            <td style="width: 80px" align="right">
                                                                توضیحات آزمایش :
                                                            </td>
                                                            <td align="right" dir="rtl">
                                                                <asp:TextBox ID="DescriptionTextBox" runat="server" Text='<%# Bind("Description") %>'
                                                                    TextMode="MultiLine" MaxLength="2500" Height="150px" Width="350px" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="2" align="left">
                                                                <table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
                                                                    <tr>
                                                                        <td style="height: 15px">
                                                                        </td>
                                                                        <td align="left" valign="top" style="width: 110px;">
                                                                        </td>
                                                                        <td align="left" valign="top" style="width: 110px;">
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td style="height: 15px">
                                                                            &nbsp;
                                                                        </td>
                                                                        <td align="left" valign="top" style="width: 80px">
                                                                            <asp:ImageButton ID="DeleteImageButton" runat="server" CausesValidation="False" CommandName="Delete"
                                                                                SkinID="DeleteButton" OnClientClick="if (!confirm('آيا از حذف مطمئن هستيد؟')) return false;" />
                                                                        </td>
                                                                        <td align="left" valign="top" style="width: 80px">
                                                                            <asp:ImageButton ID="UpdateImageButton" runat="server" CommandName="Update" SkinID="UpdateButton"
                                                                                ValidationGroup="Update" OnClientClick="if (!confirm('آيا از اعمال تغییرات مطمئن هستيد؟')) return false;" />
                                                                        </td>
                                                                        <td align="left" valign="top" style="width: 80px">
                                                                            <asp:ImageButton ID="CancelImageButton" runat="server" CommandName="Cancel" SkinID="CancelButton" />
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </EditItemTemplate>
                                                <InsertItemTemplate>
                                                    <table border="0" cellpadding="0" cellspacing="0" style="width: 500px">
                                                        <tr valign="middle">
                                                            <td style="width: 100px" align="right">
                                                                عنوان آزمایش :
                                                            </td>
                                                            <td style="width: 400px" align="right">
                                                                <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("CategoryItemTitle") %>'
                                                                    MaxLength="500" Width="350px" />
                                                                <asp:RequiredFieldValidator ID="TitleRequiredFieldValidator" runat="server" ControlToValidate="TitleTextBox"
                                                                    Display="Dynamic" ErrorMessage="*" ValidationGroup="Insert"></asp:RequiredFieldValidator>
                                                                <asp:HiddenField ID="CategoryIDHiddenField" runat="server" Value='<%# Bind("CategoryID") %>' />
                                                            </td>
                                                        </tr>
                                                        <tr valign="middle">
                                                            <td style="width: 100px" align="right">
                                                                توضیحات :
                                                            </td>
                                                            <td align="right" dir="rtl">
                                                                <asp:TextBox ID="DescriptionTextBox" runat="server" Text='<%# Bind("Description") %>'
                                                                    TextMode="MultiLine" MaxLength="2500" Height="150px" Width="350px" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="2" align="left">
                                                                <table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
                                                                    <tr>
                                                                        <td style="height: 15px">
                                                                            &nbsp;
                                                                        </td>
                                                                        <td align="left" valign="top" style="width: 110px;">
                                                                        </td>
                                                                        <td align="left" valign="top" style="width: 110px;">
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td style="height: 15px">
                                                                            &nbsp;
                                                                        </td>
                                                                        <td align="left" valign="top" style="width: 110px;">
                                                                            <asp:ImageButton ID="InsertButton" runat="server" CommandName="Insert" SkinID="InsertButton"
                                                                                ValidationGroup="Insert" OnClick="InsertButton_Click" />
                                                                        </td>
                                                                        <td align="left" valign="top" style="width: 110px;">
                                                                            <asp:ImageButton ID="CancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                                                                                SkinID="CancelButton" />
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </InsertItemTemplate>
                                            </asp:FormView>
                                        </td>
                                    </tr>
                                </table>
                            </asp:View>
                        </asp:MultiView>
                        <asp:HiddenField ID="CategoryIDHiddenField" runat="server" />
                        <asp:EntityDataSource ID="CategoryEntityDataSource" runat="server" ConnectionString="name=DefaultEntityConnection"
                            DefaultContainerName="DefaultEntityConnection" OrderBy="it.[CategoryTitle]" EntitySetName="Categories"
                            Select="it.[CategoryID], it.[CategoryTitle], it.[Description]" Where="(@CategoryTitle is null || it.CategoryTitle LIKE '%' + @CategoryTitle + '%')"
                            EnableFlattening="False">
                            <WhereParameters>
                                <asp:ControlParameter ControlID="CategoryTextBox" Name="CategoryTitle" Type="String" />
                            </WhereParameters>
                        </asp:EntityDataSource>
                        <asp:EntityDataSource ID="CategoryItemEntityDataSource" runat="server" ConnectionString="name=DefaultEntityConnection"
                            DefaultContainerName="DefaultEntityConnection" EnableDelete="True" EnableInsert="True"
                            EnableUpdate="True" EntitySetName="CategoryItems" OnDeleted="CategoryItemEntityDataSource_Command"
                            OnInserted="CategoryItemEntityDataSource_Command" OnUpdated="CategoryItemEntityDataSource_Command"
                            Where="it.Category.CategoryID = @CategoryID" Include="Category" EnableFlattening="False">
                            <WhereParameters>
                                <asp:ControlParameter ControlID="CategoryIDHiddenField" DbType="Int32" Name="CategoryID"
                                    PropertyName="Value" DefaultValue="0" />
                            </WhereParameters>
                        </asp:EntityDataSource>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- ####################################################################################################### -->
    <div class="wrapper row5">
        <div id="footer" class="clear">
            <!-- ####################################################################################################### -->
            <div class="foot_contact">
                <h2>
                    آزمایشگاه دبیری</h2>
                <address>
                    تهران<br />
                    میدان ونک<br />
                    جنب بانک دی<br />
                    کد پستی 2323256454
                </address>
                <ul style="text-align: right">
                    <li><strong>تلفن:</strong> 11215 54545</li>
                    <li><strong>نمابر:</strong> 14545 85787</li>
                    <li class="last"><strong>Email:</strong> <a href="#">contact@mydomain.com</a></li>
                </ul>
            </div>
            <div class="footbox">
                <h2>
                    موقعیت ما</h2>
                <ul>
                    <li><a href="#">
                        <div class="imgl">
                            <img src="../App_Themes/Default/images/map_big.jpg" alt="موقیعت ما" />
                        </div>
                    </a></li>
                </ul>
            </div>
            <!-- ####################################################################################################### -->
        </div>
    </div>
    <!-- ####################################################################################################### -->
    <div class="wrapper">
        <div id="copyright" class="clear">
            <p class="fl_left">
                Copyright &copy; 2011 - Delta System Anahita - <a href="#">Delta.com</a></p>
        </div>
    </div>
    </form>
</body>
</html>
